home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1993, 1994 Marc Parmet.
- * This file is part of the Macintosh port of GNU Emacs.
- *
- * GNU Emacs is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
- #if defined(THINK_C)
- #include <MacHeaders>
- #else
- #include <Types.h>
- #include <Memory.h>
- #include <Quickdraw.h>
- #include <Windows.h>
- #include <Dialogs.h>
- #include <SegLoad.h>
- #include <ToolUtils.h>
- #endif
-
- #include <GestaltEqu.h>
-
- static void
- blink(DialogPtr d,int i)
- {
- short type;
- ControlHandle h;
- Rect box;
- long now;
-
- GetDItem(d,i,&type,(Handle *)&h,&box);
- HiliteControl(h,inButton);
- now = TickCount();
- while (TickCount() < now+10)
- ;
- HiliteControl(h,0);
- }
-
- static pascal Boolean
- need_sys7_filter(DialogPtr d,EventRecord *e,short *i)
- {
- char c;
-
- switch (e->what) {
- case keyDown:
- c = e->message & charCodeMask;
- *i = (c == '\015' || c == '\012' || c == 3);
- blink(d,1);
- return 1;
- default:
- return 0;
- }
- }
-
- void
- check_traps(void)
- {
- short err;
- long response;
- static ModalFilterUPP need_sys7_filter_upp;
-
- if (need_sys7_filter_upp == 0L)
- need_sys7_filter_upp = NewModalFilterProc(need_sys7_filter);
-
- err = Gestalt(gestaltSystemVersion,&response);
- if (err || LoWord(response) < 0x0700) {
- InitCursor();
- Alert(132,need_sys7_filter_upp);
- ExitToShell();
- }
- }
-